# 去掉图片水印
from rembg import remove, new_session
from PIL import Image

# 指定模型类型
session = new_session("u2netp")  # 轻量级模型:ml-citation{ref="6" data="citationList"}

# 处理流程
def remove_watermark(input_path, output_path):
    inp = Image.open(input_path)
    out = remove(inp, session=session)  # 应用指定模型:ml-citation{ref="6" data="citationList"}
    out.save(output_path)
    return out

# 执行处理
remove_watermark("input.jpg", "output.png")
